<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page isELIgnored="false"%>
<html>
	<head>
		  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    	  <meta http-equiv="X-UA-Compatible" content="IE=edge">
    	  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    	  <meta name="renderer" content="webkit">
    	   <link rel="stylesheet" href="${pageContext.request.contextPath}/admin/css/pintuer.css">
    	   <link rel="stylesheet" href="${pageContext.request.contextPath}/admin/css/admin.css">
    	   <script src="${pageContext.request.contextPath}/admin/js/jquery.js"></script>
    	   <script src="${pageContext.request.contextPath}/admin/js/pintuer.js"></script>  
	</head>
  <body>
   <div class="panel admin-panel margin-top">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>添加菜单</strong></div>
  <div class="body-content">
    <form method="post" class="form-x" >   
      <input type="hidden" name="id"  value="" />  
      <div class="form-group">
        <div class="label">
          <label>菜单编码：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" id="menuCode" value="" data-validate="required:请输入菜单编码" />         
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>父节点菜单：</label>
        </div>
        <div class="field">
        <select id="menuParentCode" class="input" onchange=""  style="width:210px; line-height:17px;display:inline-block">
            <option value="">请选择类型</option>
            <option value="1">系统菜单</option>
            <option value="0">应用菜单</option>
      </select>
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>菜单名称：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" id="menuName" value="" data-validate="required:请输入菜单名称" />         
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>菜单路径：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" id="menuPath" value="" data-validate="required:请输入菜单路径" />         
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>菜单图标：</label>
        </div>
        <div class="field">
          <input type="text" id="menuIcon" class="input tips" style="width:25%; float:left;"  value=""  data-toggle="hover" data-place="right" data-image="" />
          <input type="button" class="button bg-blue margin-left" id="image1" value="+ 浏览上传"  style="float:left;">
          <div class="tipss">图片尺寸：500*500</div>
        </div>
      </div>  
       <div class="form-group">
        <div class="label">
          <label>菜单类型：</label>
        </div>
        <div class="field">
        <select id="menuType" class="input" onchange=""  style="width:210px; line-height:17px;display:inline-block">
            <option value="">请选择类型</option>
            <option value="1">系统菜单</option>
            <option value="0">应用菜单</option>
      </select>
          <div class="tips"></div>
        </div>
      </div>
     <div class="form-group">
        <div class="label">
          <label>菜单排序：</label>
        </div>
        <div class="field">
          <input type="text" class="input w50" id="menuSort" value="0"  data-validate="required:,number:排序必须为数字" />
          <div class="tips"></div>
        </div>
      </div>       
       <div class="form-group">
        <div class="label">
          <label>菜单描述：</label>
        </div>
        <div class="field">
          <input type="text" class="input" id="menuRemark" style="height:120px" value=""/>        
        </div>
      </div>
     <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button id="doAdd" class="button bg-main icon-check-square-o"  type="button">提交</button>
          <button id="cancel" class="button bg-main icon-fast-forward" type="button"> 取消</button>
        </div>
      </div>
    </form>
  </div>
  </div>
  </body>
  
  <script type="text/javascript">
    
     $("#doAdd").click(function(){
    	 doAdd();
     });
  
     //增添菜单方法
  	 function doAdd(){
  		 //菜单编码
  	  	 var menuCode = $("#menuCode").val();
  	 	 //菜单路径
  	 	 var menuPath = $("#menuPath").val();
  	 	 //菜单名称
  	  	 var menuName = $("#menuName").val();
  	 	 //菜单类型
  	  	 var menuType = $("#menuType").val();
  	  	 //菜单图标
  	  	 var menuIcon = $("#menuIcon").val();
  	  	 //菜单序号
  	  	 var menuSort = $("#menuSort").val();
  		 //菜单备注
  	  	 var menuRemark = $("#menuRemark").val();
  		 //菜单父节点编码
  		 var menuParentCode = $("#menuParentCode").val();
  		//执行ajax操作
 		$.ajax({
 		 	type:'post',
 		 	url:'${pageContext.request.contextPath}/system/menu/doAdd',
 		 	data:{
 		 		  menuCode:menuCode,
 		 		  menuPath:menuPath,
 		 		  menuName:menuName,
 		 		  menuType:menuType,
 		 		  menuIcon:menuIcon,
 		 		  menuSort:menuSort,
 		 		  menuParentCode:menuParentCode,
 		 		  menuRemark:menuRemark
 		    },
 		 	dataType:'json',
 		 	cache:false,
 		 	success:function(data)
 		 	{	
 		 		if(data.success)
 		 		{
 		 			alert(data.message);
 		 		}
 		 		else
 		 		{
 		 			alert(data.message);
 		 		}
 		 	},
 		 	error:function(data)
 		 	{
 		 		alert('系统出现异常!');
 		 	}
 		});
  	 }
  	 //取消保存操作
  	 $("#cancel").click(function(){
  		 
  	 })
  </script>
</html>
 	